<?php

namespace Acme\StoreBundle\Controller;

use Acme\StoreBundle\Entity\Product;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;


class DefaultController extends Controller
{
    public function indexAction($name)
    {
        return $this->render('StoreBundle:Default:index.html.twig', array('name' => $name));
    }

    public function createAction(){
    	$Product = new Product();
    	$Product->setName("A Foo Bar");
    	$Product->setPrice("19.99");
    	$Product->setDescription('Lorem ipsum dolor');

    	$em = $this->getDoctrine()->getManager();
    	$em->persist($Product);
    	$em->flush();
    	return new Response('Created product id '.$product->getId());
    }
}
